package com.agile.leetcode.spi.client;

import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.function.Consumer;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/21 23:16
 */
public class ConsumerClient {
    public static void main(String[] args) {
        // 加载spi
        ServiceLoader<Consumer> serviceLoader = ServiceLoader.load(Consumer.class);
        Iterator<Consumer> iterator = serviceLoader.iterator();
        while (iterator.hasNext()){
            iterator.next().accept("czk");
        }
    }
}
